/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ATBMS.view.manager;

import ATBMS.modles.Flight;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 *
 * @author Felix
 */
public class EditFlightDialog extends FlightDialogImpl {

    private int fid;

    public EditFlightDialog(java.awt.Frame parent, Flight flight) {
        super(parent);

        fid = flight.getFid();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm");


        gooffTextField.setText(dateFormat.format(flight.getFgooff()));
        arrivalTextField.setText(dateFormat.format(flight.getFarrival()));
        busloadTextField.setText(String.valueOf(flight.getFbusload()));
        airlineTextField.setText(flight.getFairline());
        destTextField.setText(flight.getFdest());
        flightTextField.setText(flight.getFcode());
        equipTextField.setText(flight.getFequip());
        priceTextField.setText(String.valueOf(flight.getFprice()));
    }
    @Override
    public Flight doModal() {
        Flight ret=super.doModal();
        if(ret!=null){
            ret.setFid(fid);
        }
        return ret;
    }
}
